package com.alks.function.controller;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.yield.CutYieldRequest;
import com.alks.function.service.CutYieldService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author:xxxxx
 * @create: 2023-07-12 10:02
 * @Description: 产量完成
 */
@ApiRestController("/yield")
@Api(tags = {"荣阳查询 -- 裁断、针车产量/出货资料"})
public class YieldCompleteController {
    @Autowired
    CutYieldService cutYieldService;
    @PostMapping("/cutYieldList")
    @ApiOperation("裁断完成产量查询")
    @WebLogger
    public ResponseInfo cutYieldList(@RequestBody CutYieldRequest request){
        return cutYieldService.cutYieldList(request);
    }

    //裁断产量导出日报表
    @PostMapping("/downloadCutYield")
    @WebLogger
    @ApiOperation("裁断产量导出日报表")
    public void  downloadCutYield(HttpServletResponse response,@RequestBody CutYieldRequest request,@RequestParam @ApiParam("1: 裁断 2：针车") String choose) throws IOException {
        cutYieldService.downloadCutYield(response,request,choose);
    }

    @GetMapping("/getCutYieldCondition")
    @ApiOperation("裁断完成、针车完成条件返回")
    @WebLogger
    public ResponseInfo getCutYieldCondition(){
        return cutYieldService.getCutYieldCondition();
    }

    @PostMapping("/stitchYieldList")
    @ApiOperation("针车完成产量查询")
    @WebLogger
    public ResponseInfo stitchYieldList(@RequestBody CutYieldRequest request){
        return cutYieldService.stitchYieldList(request);
    }

    @PostMapping("/outStockDetail")
    @ApiOperation("出货明细查询")
    @WebLogger
    public ResponseInfo outStockDetail(@RequestBody CutYieldRequest request){
        return cutYieldService.outStockDetail(request);
    }
}
